//
//  MarketDeatilHeadView.m
//  BTCoin
//
//  Created by zzg on 2018/4/14.
//  Copyright © 2018年 Robin. All rights reserved.
//

#import "MarketDeatilHeadView.h"
#import "Masonry.h"

#define kContentLabelWidth  (kScreenWidth - 50)/2
@interface MarketDeatilHeadView ()
@property (nonatomic, strong) UILabel   *highLabel;
@property (nonatomic, strong) UILabel   *lowLabel;
@property (nonatomic, strong) UILabel   *zfLabel;
@property (nonatomic, strong) UILabel   *twentyLabel;

@end
@implementation MarketDeatilHeadView
- (instancetype)initWithFrame:(CGRect)frame {
    self = [super initWithFrame:frame];
    if (self) {
        [self setSubviewsAdd];
    }
    return self;
}

- (void)setSubviewsAdd {
    [self addSubview:self.newsPrice];
    [self addSubview:self.HighPrice];
    [self addSubview:self.lowPrice];
    [self addSubview:self.zfPrice];
    [self addSubview:self.twenty_fourPrice];
    [self addSubview:self.highLabel];
    [self addSubview:self.lowLabel];
    [self addSubview:self.zfLabel];
    [self addSubview:self.twentyLabel];
    
    [self setSubviewsLayout];
}

- (void)setSubviewsLayout {
    [self.newsPrice mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.mas_equalTo(self.mas_left).with.offset(15);
        make.top.mas_equalTo(self.mas_top).with.offset(5);
        make.height.equalTo(@80);
        make.width.mas_equalTo(kContentLabelWidth);
    }];
    
    [self.HighPrice mas_makeConstraints:^(MASConstraintMaker *make) {
        make.right.mas_equalTo(self.mas_right).with.offset(-15);
        make.top.mas_equalTo(self.newsPrice);
        make.height.equalTo(@35);
        make.width.mas_equalTo(kContentLabelWidth);
    }];
    
    [self.lowPrice mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.right.width.height.mas_equalTo(self.HighPrice);
        make.top.mas_equalTo(self.HighPrice.mas_bottom).with.offset(10);
    }];
    
    [self.zfPrice mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.mas_equalTo(self.newsPrice.mas_left);
        make.top.mas_equalTo(self.newsPrice.mas_bottom).with.offset(10);
        make.height.width.mas_equalTo(self.HighPrice);
    }];
    
    [self.twenty_fourPrice mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.mas_equalTo(self.HighPrice.mas_left);
        make.top.mas_equalTo(self.zfPrice);
        make.height.width.mas_equalTo(self.HighPrice);
    }];
    
    [self.highLabel mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.top.bottom.mas_equalTo(self.HighPrice);
    }];
    
    [self.lowLabel mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.top.bottom.mas_equalTo(self.lowPrice);
    }];
    
    [self.zfLabel mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.top.bottom.mas_equalTo(self.zfPrice);
    }];
    
    [self.twentyLabel mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.top.bottom.mas_equalTo(self.twenty_fourPrice);
    }];
    
}

- (UILabel *)newsPrice {
    if (!_newsPrice) {
        _newsPrice = [[UILabel alloc] init];
        _newsPrice.font = [UIFont systemFontOfSize:30];
        _newsPrice.textAlignment = NSTextAlignmentCenter;
        _newsPrice.text = @"0.0001";
    }
    return _newsPrice;
}


- (UILabel *)HighPrice {
    if (!_HighPrice) {
        _HighPrice = [[UILabel alloc] init];
        _HighPrice.font = [UIFont systemFontOfSize:18];
        _HighPrice.textAlignment = NSTextAlignmentRight;
        _HighPrice.text = @"0.003";
    }
    return _HighPrice;
}

- (UILabel *)lowPrice {
    if (!_lowPrice) {
        _lowPrice = [[UILabel alloc] init];
        _lowPrice.font = [UIFont systemFontOfSize:18];
        _lowPrice.textAlignment = NSTextAlignmentRight;
        _lowPrice.text = @"0.0001";
    }
    return _lowPrice;
}

- (UILabel *)zfPrice {
    if (!_zfPrice) {
        _zfPrice = [[UILabel alloc] init];
        _zfPrice.font = [UIFont systemFontOfSize:18];
        _zfPrice.textAlignment = NSTextAlignmentRight;
        _zfPrice.text = @"0.02%";
    }
    return _zfPrice;
}

- (UILabel *)twenty_fourPrice {
    if (!_twenty_fourPrice) {
        _twenty_fourPrice = [[UILabel alloc] init];
        _twenty_fourPrice.font = [UIFont systemFontOfSize:18];
        _twenty_fourPrice.textAlignment = NSTextAlignmentRight;
        _twenty_fourPrice.text = @"0 ETH";
    }
    return _twenty_fourPrice;
}

- (UILabel *)highLabel {
    if (!_highLabel) {
        _highLabel = [[UILabel alloc] init];
        _highLabel.font = [UIFont systemFontOfSize:18];
        _highLabel.textAlignment = NSTextAlignmentLeft;
        _highLabel.textColor = [UIColor blackColor];
        _highLabel.text = @"最高";
    }
    return _highLabel;
}

- (UILabel *)lowLabel {
    if (!_lowLabel) {
        _lowLabel = [[UILabel alloc] init];
        _lowLabel.font = [UIFont systemFontOfSize:18];
        _lowLabel.textAlignment = NSTextAlignmentLeft;
        _lowLabel.textColor = [UIColor blackColor];
        _lowLabel.text = @"最低";
    }
    return _lowLabel;
}

- (UILabel *)zfLabel {
    if (!_zfLabel) {
        _zfLabel = [[UILabel alloc] init];
        _zfLabel.font = [UIFont systemFontOfSize:18];
        _zfLabel.textAlignment = NSTextAlignmentLeft;
        _zfLabel.textColor = [UIColor blackColor];
        _zfLabel.text = @"涨幅";
    }
    return _zfLabel;
}

- (UILabel *)twentyLabel {
    if (!_twentyLabel) {
        _twentyLabel = [[UILabel alloc] init];
        _twentyLabel.font = [UIFont systemFontOfSize:18];
        _twentyLabel.textAlignment = NSTextAlignmentLeft;
        _twentyLabel.textColor = [UIColor blackColor];
        _twentyLabel.text = @"量24H";
    }
    return _twentyLabel;
}
@end
